import { EntitySchema } from '@mikro-orm/core';

export class TypechoMetas {
  mid!: number;
  name?: string;
  slug?: string;
  type!: string;
  description?: string;
  count?: number = 0;
  order?: number = 0;
  parent?: number = 0;
  imgurl?: string;
  isrecommend?: number = 0;
}

export const TypechoMetasSchema = new EntitySchema({
  class: TypechoMetas,
  properties: {
    mid: { primary: true, type: 'number' },
    name: { type: 'string', length: 150, nullable: true },
    slug: { type: 'string', length: 150, nullable: true, index: 'slug' },
    type: { type: 'string', length: 32 },
    description: { type: 'string', length: 150, nullable: true },
    count: { type: 'number', nullable: true, default: 0 },
    order: { type: 'number', nullable: true, default: 0 },
    parent: { type: 'number', nullable: true, default: 0 },
    imgurl: { type: 'string', length: 500, nullable: true },
    isrecommend: { type: 'number', nullable: true, default: 0 },
  },
});
